package com.lkm.app_ui.m.Imple.steelyard_auto;

import android.Manifest;

import com.lkm.frame.module.ConditionConfige;
import com.lkm.frame.module.ModuleDelegate;
import com.lkm.frame.module.ModuleManager;
import com.lkm.frame.module.PermissionCondition;
import com.lkm.market2_0.m.steelyarddata.SteelyardDataModule;
import com.lkm.market2_0.m.steelyardserver.SteelyardServerModule;
import com.lkm.market2_0.m.steelyardstatus.SteelyardStatusManagerModule;




public class SteelyardServerModuleDelegateAuto implements ModuleDelegate<SteelyardServerModule, DeviceinitPo> {

    private ModuleManager mModuleManager;

    @Override
    public void init(ModuleManager moduleManager) {
        mModuleManager = moduleManager;
    }

    @Override
    public void dependency(DependencyConfig dc) {
        dc.addDependency(SteelyardStatusManagerModule.class);
        dc.addDependency(SteelyardDataModule.class);

        LoadDeviceInitTask task = new LoadDeviceInitTask(mModuleManager, this);
        task.action();
        task.execTask();
    }

    @Override
    public void configure(ConditionConfige<DeviceinitPo> cc) {
        cc.setPermissCondition(new PermissionCondition() {
            @Override
            public String[] initMissPermission() {
                return new String[]{
                        
                        Manifest.permission.ACCESS_FINE_LOCATION,
                        Manifest.permission.ACCESS_COARSE_LOCATION
                };
            }

            @Override
            public String[] initRunPermission() {
                return new String[0];
            }

            @Override
            public boolean isLazyRequestPermission() {
                return false;
            }
        });







    }

    @Override
    public SteelyardServerModule execute(DeviceinitPo deviceinitPo) {
        SteelyardStatusManagerModule steelyardStatusManagerModule = mModuleManager.loadModule(SteelyardStatusManagerModule.class);
        return new SteelyardServerModuleAuto(steelyardStatusManagerModule, deviceinitPo);
    }

    @Override
    public Class<SteelyardServerModule> getModuleInterfaceClass() {
        return SteelyardServerModule.class;
    }

    @Override
    public void onError(ErrorWarp e) {

    }
}
